package com.atguigui.leetcode;

/**
 * 2011.执行操作后的变量值
 * Project: leetcode
 * Package: com.atguigui.leetcode
 * Version: 1.0
 * <p>
 * Created by WJX on 2022/12/23 8:40
 */
public class P2011FinalValueOfVariableAfterPerformingOperations {
    public static void main(String[] args) {
        Solution solution = new P2011FinalValueOfVariableAfterPerformingOperations().new Solution();
        // TO TEST
    }

    class Solution {
        public int finalValueAfterOperations(String[] operations) {

            int ans = 0;
            for (String operation : operations) {
                if (operation.contains("-")) {
                    --ans;
                } else {
                    ++ans;
                }
            }
            return ans;
        }
    }
}
